package ua.ck.example.domain;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;

@Entity
@Table(name = "customers")
public class Customer implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 249322129641088164L;
	@Id
	@GeneratedValue
	private Integer customerId;
	@Size(min = 3, max = 30)
	private String customerName;
	@NotNull
	@NotEmpty
	private String password;

	@NotNull
	@NotEmpty
	private String customerAdd;

	private Timestamp customerBir;
	@Size(min = 10)
	private String customerTele;
	@OneToMany(fetch = FetchType.EAGER, mappedBy = "customer")
	private Set<Order> orders = new HashSet<Order>(0);// if in order,the related
														// method is
														// getICustomer,it will
														// be iCustomer

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Integer getCustomerId() {
		return customerId;
	}

	public void setCustomerId(Integer customerId) {
		this.customerId = customerId;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public String getCustomerAdd() {
		return customerAdd;
	}

	public void setCustomerAdd(String customerAdd) {
		this.customerAdd = customerAdd;
	}

	public Set<Order> getOrders() {
		return orders;
	}

	public void setOrders(Set<Order> orders) {
		this.orders = orders;
	}

	public String getCustomerTele() {
		return customerTele;
	}

	public void setCustomerTele(String customerTele) {
		this.customerTele = customerTele;
	}

	public Timestamp getCustomerBir() {
		return customerBir;
	}

	public void setCustomerBir(Timestamp customerBir) {
		this.customerBir = customerBir;
	}

}
